package com.dadaguai.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dadaguai.common.R;
import com.dadaguai.domain.EmailCode;
import com.dadaguai.mapper.EmailCodeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class Test {
    @Autowired
    EmailCodeMapper emailCodeMapper;

    @Autowired
    StringRedisTemplate stringRedisTemplate;

    @RequestMapping("/test")
    public R test() {
        LambdaQueryWrapper<EmailCode> queryWrapper = Wrappers.lambdaQuery();
        List<EmailCode> list = emailCodeMapper.selectList(queryWrapper);

        return R.success(list);
    }


    @RequestMapping("/get")
    public R getById() {
        String k1 = stringRedisTemplate.opsForValue().get("k1");
        return R.success(k1);
    }


}
